package com.xyz.dao.logic;

import com.free.ext.mybatis.model.entity.PageResponseModel;
import com.xyz.dao.dao.SLotteryPeriodDao;
import com.xyz.domain.model.LotteryPeriodSearchModel;
import com.xyz.domain.model.LotteryPeriodSearchResModel;
import com.xyz.domain.table.SLotteryPeriod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class SLotteryPeriodLogic {

    @Autowired
    private SLotteryPeriodDao sLotteryPeriodDao;

    public SLotteryPeriod add(SLotteryPeriod sLotteryPeriod){
        return sLotteryPeriodDao.insert(sLotteryPeriod);
    }

    public Integer update(SLotteryPeriod sLotteryPeriod){
        return sLotteryPeriodDao.update(sLotteryPeriod);
    }

    public List<SLotteryPeriod> list(SLotteryPeriod sLotteryPeriod, String orderBy){
        return sLotteryPeriodDao.selectList(sLotteryPeriod, orderBy);
    }

    public Integer delete(Integer key){
        return sLotteryPeriodDao.delete(key);
    }

    public PageResponseModel<SLotteryPeriod> pageInfo(SLotteryPeriod sLotteryPeriod, String orderBy, Integer pageNo, Integer pageSize){
        return sLotteryPeriodDao.selectByPageNo(sLotteryPeriod, orderBy, pageNo, pageSize);
    }

    public Integer getLotteryMaxPeriod(SLotteryPeriod period){
        return sLotteryPeriodDao.getLotteryMaxPeriod(period);
    }

    public List<LotteryPeriodSearchResModel> getLotteryPeriodList(LotteryPeriodSearchModel serCond){
        return sLotteryPeriodDao.getLotteryPeriodList(serCond);
    }

    public PageResponseModel<LotteryPeriodSearchResModel> selectPeriodPageInfo(LotteryPeriodSearchModel condition, String orderBy, int pageNo, int pageSize){
        return sLotteryPeriodDao.selectByPageNo(condition,orderBy,pageNo,pageSize);
    }

    public PageResponseModel<LotteryPeriodSearchResModel> getTodayLotteryInfo(LotteryPeriodSearchModel condition, String orderBy, int pageNo, int pageSize){
        return sLotteryPeriodDao.getTodayLotteryInfo(condition, orderBy, pageNo, pageSize);
    }

    public List<SLotteryPeriod> getTop400Info(String lotteryCode){
        return sLotteryPeriodDao.getTop400Info(lotteryCode);
    }

    public SLotteryPeriod getCurrentLotteryPeriodInfo(String lotteryCode){
        return sLotteryPeriodDao.getCurrentLotteryPeriodInfo(lotteryCode);
    }

}